package servlet.huwenyao;

import pojo.Goods;
import pojo.Order;
import pojo.User;
import service.OrderService;
import service.impl.OrderServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet(value = "/InsertEvaluateEchoServlet")
public class InsertEvaluateEchoServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setCharacterEncoding("utf-8");
        request.setCharacterEncoding("UTF-8");
        //实例化service层
        String id=request.getParameter("orderId");
        OrderService o=new OrderServiceImpl();
        Goods goods=new Goods();
        String wareId[]=o.finaOrder(Integer.parseInt(id)).getWareId().split(",");
        int num=wareId.length;
        for (int i=0;i<wareId.length;i++){
            goods=o.finaGoods(Integer.parseInt(wareId[i]));
        }
        System.out.println(goods);
        request.setAttribute("goods",goods);
        request.getRequestDispatcher("jsp/hwy/InsePageEvaluate.jsp").forward(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}
